%% SETUP

clear all

% A) Set global parameters

% Indicator for use of sample:

clear global samp
global samp

samp = false;

% B) Load data and create variables

setup_c2



%% TEST RUN

% Test parameter values (easy to compute):

param = [0.1 1.0 0 0];

% Make objective matrix:

[N_prefs, N_alphas, alpha_list, start_H] = make_Q_c2( param );

% Solve QP problem:

if samp
    [x,objval,LPslack] = solve_samp(N_prefs, N_alphas, alpha_list, start_H);
else
    [x,objval,LPslack] = solve_pop(N_prefs, N_alphas, alpha_list, start_H);
end




%% RUN MCMC ALGORITHM

% Initial parameter values:

param = [    0.1    1.5   -0.4    0.5];

% Run a chain with 100 evaluations:

[parameters, ~, densities] = mhsample_dens(param,100,'logpdf',@make_dens_c2,'proprnd',@propnorm,'symmetric',1);

% Save result:

save mh_search01.mat parameters densities



exit
